package com.lutzyt.delivery.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lutzyt.delivery.bean.RolePermission;
import com.lutzyt.delivery.service.RolePermissionService;
import com.lutzyt.delivery.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 * @author zyt
 */
@RestController
@RequestMapping("/api/role/permission")
@Api(tags = "")
public class RolePermissionController {
  private RolePermissionService rolePermissionService;

  @GetMapping("/{id}")
  @ApiOperation("通过ID查询list")
  public Result<RolePermission> findById(@ApiParam("ID") @PathVariable("id") Integer id) {
    return Result.success(rolePermissionService.findById(id));
  }

  @PostMapping
  @ApiOperation("新增")
  public Result<Void> insert(@RequestBody RolePermission rolePermission) {
    rolePermissionService.insert(rolePermission);
    return Result.success();
  }

  @Autowired
  public void setRolePermissionService(RolePermissionService rolePermissionService) {
    this.rolePermissionService = rolePermissionService;
  }
}
